package com.wangtao.service;

import com.alibaba.dubbo.config.annotation.Reference;
import com.wangtao.api.ApiHouseResourcesService;
import com.wangtao.pojo.HouseResources;
import com.wangtao.vo.PageInfo;
import com.wangtao.vo.Pagination;
import com.wangtao.vo.TableResult;
import org.springframework.stereotype.Service;

@Service
public class HouseResourcesService {

    @Reference(version = "1.0.0")
    private ApiHouseResourcesService apiHouseResourcesService;

    public boolean save(HouseResources houseResources){
        int result = this.apiHouseResourcesService.saveHouseResources(houseResources);
        return result == 1;
    }

    public TableResult<HouseResources> queryList(HouseResources houseResources, Integer currentPage, Integer pageSize) {
        PageInfo<HouseResources> pageInfo = this.apiHouseResourcesService.queryHouseResourcesList(currentPage, pageSize, houseResources);
        return new TableResult<>(pageInfo.getRecords(),new Pagination(currentPage, pageSize, pageInfo.getTotal()));

    }
}